import React, { Component } from 'react';
import TermsInfo from './components/TermsInfo';
import axios from 'axios'
export default class BlogRead extends Component {
  static displayName = 'BlogRead';

  constructor(props) {
    super(props);
    this.state = {
      dataSource: [],
    };
  }


  componentWillMount() {

    this.getData()

  }

  getData = () => {
    axios.get(` http://zzuisa.cn/reader/article/get/${this.props.match.params.id}`).then((res) => {
      console.log('res,',res)
      if (res.data.code === 0) {
        this.setState({
          dataSource: res.data.data
        })
      }
    })
  }
  render() {
    return (
      <div className="dashboard-page">
        <TermsInfo
          dataSource={this.state.dataSource}
          history={this.props.history}
          id={this.props.match.params.id}
          total={this.props.match.params.total}
        />
      </div>
    );
  }
}
